<template>
<footer class="footer">
      <span class="todo-count" v-show="residue"><strong>{{residue}}</strong>剩余</span>
      <ul class="filters">
        <li>
          <a :class="{selected : type === 'all'}" 
          href="#/"
          @click="changeType('all')"
          >全部</a>
        </li>
        <li>
          <a :class="{selected : type === 'active'}" 
          href="#/active"
          @click="changeType('active')"
          >进行中</a>
        </li>
        <li>
          <a :class="{selected : type === 'completed'}" 
          href="#/completed"
          @click="changeType('completed')"
          >已完成</a>
        </li>
      </ul>
      <button 
      class="clear-completed" 
      @click="cleanup"
      v-show="islListAll"
      >清除已完成</button>
    </footer>
</template>

<script>
 export default {
   name: 'TodoFooter',
   props: {
    residue:{
        type:Number,
        require:true,
    },
    islListAll:{
        type:Boolean,
        require:true,
    },
    type:{
        type:String,
        require:true,
    }
   },

   methods:{
    cleanup(){
        this.$emit("cleanup")
    },

    changeType(type){
        this.$emit("changeType",type)
    }
   },
   
 }
</script>

<style scoped lang='less'>

</style>